package com.owulia.leetcode.num;

import com.alibaba.fastjson.JSONObject;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class CardRate {

    private static List<Short> spadeCars = new ArrayList<Short>() {
        private static final long serialVersionUID = -6299879299406141741L;

        {
            add((short) 101);
            add((short) 102);
            add((short) 103);
            add((short) 104);
            add((short) 105);
            add((short) 106);
            add((short) 107);
            add((short) 108);
            add((short) 109);
            add((short) 110);
            add((short) 111);
            add((short) 112);
            add((short) 113);
        }
    };
    private static List<Short> heartCars = new ArrayList<Short>() {
        private static final long serialVersionUID = -6299879299406141741L;

        {
            add((short) 201);
            add((short) 202);
            add((short) 203);
            add((short) 204);
            add((short) 205);
            add((short) 206);
            add((short) 207);
            add((short) 208);
            add((short) 209);
            add((short) 210);
            add((short) 211);
            add((short) 212);
            add((short) 213);
        }
    };
    private static List<Short> clubCars = new ArrayList<Short>() {
        private static final long serialVersionUID = -6299879299406141741L;

        {
            add((short) 301);
            add((short) 302);
            add((short) 303);
            add((short) 304);
            add((short) 305);
            add((short) 306);
            add((short) 307);
            add((short) 308);
            add((short) 309);
            add((short) 310);
            add((short) 311);
            add((short) 312);
            add((short) 313);
        }
    };
    private static List<Short> diamondCars = new ArrayList<Short>() {
        private static final long serialVersionUID = -6299879299406141741L;

        {
            add((short) 401);
            add((short) 402);
            add((short) 403);
            add((short) 404);
            add((short) 405);
            add((short) 406);
            add((short) 407);
            add((short) 408);
            add((short) 409);
            add((short) 410);
            add((short) 411);
            add((short) 412);
            add((short) 413);
        }
    };


    public static List<Short> noKingCards = new ArrayList<Short>() {
        private static final long serialVersionUID = -8504096051044478497L;

        {
            addAll(spadeCars);
            addAll(heartCars);
            addAll(clubCars);
            addAll(diamondCars);
        }
    };


    public static void shu() {
        List<List<Short>> shuList = new ArrayList<>();
        for (int i = 0; i < noKingCards.size(); i++) {
            for (int j = i + 1; j < noKingCards.size(); j++) {
                List<Short> handList = Arrays.asList(noKingCards.get(i), noKingCards.get(j));
                shuList.add(handList);
            }
        }
        int nKAP = 0;
        int hKA = 0;
        int hA = 0;
        int hPair = 0;
        int hAA = 0;
        for (List<Short> shorts : shuList) {
            int a = shorts.get(0) % 100;
            int b = shorts.get(1) % 100;
            if (a != 13 && b != 13 && a != b && a != 1 && b != 1) {
                nKAP++;
            }
            if (a == 13 || b == 13 || a == 1 || b == 1) {
                hKA++;
            }
            if (a == 1 || b == 1) {
                hA++;
                System.out.println(JSONObject.toJSON(shorts));
            }
            if (a == b) {
                hPair++;
            }
            if (a == 1 && b == 1) {
                hAA++;
            }
        }
        System.out.println("nKAP:" + nKAP);
        System.out.println("hKA:" + hKA);
        System.out.println("hA:" + hA);
        System.out.println("hPair:" + hPair);
        System.out.println("hAA:" + hAA);
        System.out.println(shuList.size());
    }

    public static void main(String[] args) {
        shu();
    }

}
